﻿public class Solution {
    public int LengthOfLIS(int[] nums)
    {
        int[] dp = new int[nums.Length];
        Array.Fill(dp, 1);

        int res = 1;
        for (int i = 1; i < nums.Length; i++)
        {
            for (int j = 0; j < i; j++)
            {
                if (nums[i] > nums[j]) dp[i] = Math.Max(dp[i], dp[j] + 1);
            }

            if (dp[i] > res) res = dp[i];
        }
        return res;
    }

    public static void Main(string[] args)
    {
        int[] nums = [10, 9, 2, 5, 3, 7, 101, 18];
        Solution solution = new Solution();
        int res = solution.LengthOfLIS(nums);
        Console.WriteLine(res);
    }
}